home *** CD-ROM | disk | FTP | other *** search
/ Merciful 2 / Merciful - Disc 2.iso / software / d / devioustools19.dms / devioustools19.adf / utils / 005.lzx / CompactPlayer / Source / gadgetbox.asm < prev    next >
Assembly Source File  |  1978-01-22  |  1KB  |  67 lines

  1. * ============================================================================ *
  2. *    SetupGadgetIBox: figures the real hit box for a gadget
  3. *
  4. *            SetupGadgetIBox(gadget,domain,result)
  5. *                       a0    a1     a2
  6. *
  7. *    This function computes the hit box for a gadget, taking the "gadget
  8. *    relativity" flags, such as GRELWIDTH, into account.
  9. * ============================================================================ *
  10.  
  11.             include        "exec/types.i"
  12.             include        "intuition/intuition.i"
  13. ;            include        "macros.i"
  14.  
  15.             SECTION        gadgetbox.asm,CODE
  16.  
  17.             xdef        _SetupGadgetIBox,SetupGadgetIBox,@SetupGadgetIBox
  18.  
  19. ;qregs        reg            d2-d7/a6
  20.  
  21. ; bit definitions for intuition gadget flags
  22.  
  23. GBOTTOM        equ            3
  24. GRIGHT        equ            4
  25. GWIDTH        equ            5
  26. GHEIGHT        equ            6
  27.  
  28. _SetupGadgetIBox:
  29.             move.l        a2,-(sp)
  30.             movem.l        8(sp),a0-a2
  31.             bsr            SetupGadgetIBox
  32.             move.l        (sp)+,a2
  33.             rts
  34.  
  35. @SetupGadgetIBox:
  36. SetupGadgetIBox:
  37.             move.w        gg_LeftEdge(a0),ibox_Left(a2)
  38.             move.w        gg_TopEdge(a0),ibox_Top(a2)
  39.             move.w        gg_Width(a0),ibox_Width(a2)
  40.             move.w        gg_Height(a0),ibox_Height(a2)
  41.  
  42.             move.w        gg_Flags(a0),d0
  43.  
  44.             btst        #GRIGHT,d0
  45.             beq.s        1$
  46.             move.w        ibox_Width(a1),d1
  47.             add.w        d1,ibox_Left(a2)
  48.  
  49. 1$            btst        #GBOTTOM,d0
  50.             beq.s        2$
  51.             move.w        ibox_Height(a1),d1
  52.             add.w        d1,ibox_Top(a2)
  53.  
  54. 2$            btst        #GWIDTH,d0
  55.             beq.s        3$
  56.             move.w        ibox_Width(a1),d1
  57.             add.w        d1,ibox_Width(a2)
  58.  
  59. 3$            btst        #GHEIGHT,d0
  60.             beq.s        4$
  61.             move.w        ibox_Height(a1),d1
  62.             add.w        d1,ibox_Height(a2)
  63.  
  64. 4$            rts
  65.  
  66.             end
  67.